package com.chepaandvasia.dao;

import java.util.List;

import com.chepaandvasia.entities.Role;
import com.chepaandvasia.entities.User;

public interface RoleDAO {

	
	   /*
     * This method inserts Role role in the database.
     * While inserting, role is given unique id
     * @param role instance of Role  to be created     
     */
    public void create(Role role);

    /*
     * This method get instance of Role, specified with given id, from database.
     * @param id id of Role to be retrieved
     * @return instance of Role with given id     
     */
    public Role get(Long id);

    /*
     * This method updates state of Role into database
     * @param role instance of Role to be updated in database     * 
     */
    public void update(Role role);

    /*
     * This method removes Role role from database.
     * @param role instance of Role to be removed
     */
    public void remove(Role role);
    
     /*
     * This method finds role for given user.
     * @param user instance of User
     * @return list of Roles of given user
     */
    public List<Role> findRoleForUser(User position);

    /*
     * This method find all roles
     * @return list of all Roles 
     */
    public List<Role> findAllRoles();
        
    /*
     * This methd return all Roles with selected authority
     * @param authority = String
     * @return list of all Roles with this authority
     */
    public List<Role> getRolesByAuthority(String authority);
    
} 